module.exports = {
  // 页面标题、 搜索框、导航栏链接、多语言切换、仓库链接
  title: "前端打卡星球UI库",
  decription: "我的UI组件库",
  head: [],
  base: "",
  // host: "",
  port: 8080,
  dest: "../../dist",
  locales: {
    "/": {
      lang: "en-US",
      title: "heli-ui",
      decription: "my ui components store",
    },
    "/zh/": {
      lang: "zh-CN",
      title: "heli-ui",
      decription: "我的UI组件库",
    }
  },
  // shouldPrefetch: () => { },
  // cache: false,
  extraWatchFiles: [
    ".vuepress/nav/en.js",
    ".vuepress/nav/zh.js"
  ],
  themeConfig: {
    locales: {
      "/": {
        label: 'English',
        selectText: 'Languages',
        ariaLabel: 'Select language',
        editLinkText: 'Edit this page on GitHub',
        lastUpdated: 'Last Updated',
        nav: require("./nav/en.js"),
        sidebar: {
          "/guide/": getGuideSidebar(["指南"]),
          "/components/": getComponentSidebar(['基础', '表单', '数据', '提示', '导航', '其他']),
        }
      },
      "/zh/": {
        label: '简体中文',
        selectText: '选择语言',
        ariaLabel: '选择语言',
        editLinkText: '在 GitHub 上编辑此页',
        lastUpdated: '上次更新',
        nav: require("./nav/zh.js"),
        sidebar: {
          "/zh/guide/": getGuideSidebar(["指南"]),
          "/zh/components/": getComponentSidebar(['基础', '表单', '数据', '提示', '导航', '其他']),
        }
      }
    }
  }
}


function getGuideSidebar(groups) {
  return [
    {
      title: groups[0],   // 必要的
      // path: '',      // 可选的, 标题的跳转链接，应为绝对路径且必须存在
      collapsable: false, // 可选的, 默认值是 true,
      // sidebarDepth: 1,    // 可选的, 默认值是 1
      children: [
        '',
        'navigation',
      ]
    },
  ]
}


function getComponentSidebar(groups) {
  return [
    {
      title: "组件",
      collapsable: false,
      children: [
        {
          title: groups[0],
          collapsable: false,
          children: [
            '',
            'container',
            'color',
            'border',
          ]
        },
        {
          title: groups[1],
          collapsable: false,
          children: [
            'input',
            'button'
          ]
        },
        {
          title: groups[2],
          collapsable: false,
          children: [
            'table',
            'tree'
          ]
        },
        {
          title: groups[3],
          collapsable: false,
          children: [
            'alert',
            'message',
          ]
        },
        {
          title: groups[4],
          collapsable: false,
          children: [
            'navmenu',
            'tabs'
          ]
        },
        {
          title: groups[5],
          collapsable: false,
          children: [
            'dialog',
            'backtop',
          ]
        },
      ]
    },

  ]
}